<?php
set_time_limit(0); 
include_once('simple_html_dom.php');
header("Content-Type: text/html; charset=UTF-8");

//=======================================

$str=file_get_contents('http://www.wooyun.org/corps/Yahoo/雅虎');
preg_match('/共.*页/',$str,$out);
preg_match_all('/\d+/', $out[0], $pages);
echo ($pages[0][0])."<br/>";
//print $pages[1];;
//======================================


//preg_match('/记录.*页/',$str,$out2);
//preg_match_all('/\d+/', $out2[0], $pages2);
echo ($pages[0][1])."<br/>";

//======================================

$html = file_get_html('http://www.wooyun.org/corps/Yahoo/雅虎');

//找到所有图片


foreach($html->find('table[class=listTable]') as $table)
{
#var_dump($table);
 //echo $table->find('tr',1)->plaintext;
 if  (count($table->find('tr')) < 5)
 {
continue;
 }
  foreach($table->find('tr') as $tr)
  {
     //echo $tr->find('td',2)->plaintext;
 if  (($tr->find('td',0)->plaintext) == "漏洞名称")
 {
continue;
 }
 //   echo ($tr->find('td',0)->plaintext)."  ";
    echo ($tr->find('a',0)->plaintext)."&nbsp;&nbsp;&nbsp;";
    echo "<a href='http://www.wooyun.org".($tr->find('a',1)->href)."'  target='_blank'>";
    echo ($tr->find('td',0)->plaintext)."</a>";
  //  {
     //  foreach($tr->find('td') as $td) 
//	{
	 //echo  mb_convert_encoding($td, "UTF-8");
//        foreach($td as $value)
  //      {   
     //   echo $tr->find('td',2);
           // echo $tr->find('td')->plaintext;
  //  //    }
   // echo ' ';
   // };
$vul_page=file_get_html('http://www.wooyun.org'.($tr->find('a',1)->href));
//preg_match('/简要描述：</h3>;/',$vul_page,$vul_detail);
//preg_match_all('/>.*</', $vul_detail[0], $out);
//echo ($out[0][0])."<br/>";
echo "&nbsp;&nbsp;&nbsp;".$vul_page->find('p[class=detail]',2)->plaintext;

     echo "<br/>";
  }
   // }
}

?>
